/* *****************************************************************************
 * Copyright (c) Huawei Technologies Co., Ltd. 2015-2022. All rights reserved.
 ******************************************************************************
  File name: Smf_instance_id.h
  Version No.: Draft
  Generation date: June 29,: 2015
  Latest modification:
  Function Description: Smf_instance_id.h header file
  Function list:
  Modification history:
  1. Date: June 29,: 2015
    Modify content: Create a file.

***************************************************************************** */

#ifndef SMF_INSTANCE_ID
#define SMF_INSTANCE_ID


#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif /* __cplusplus */

#define SMF_MEM_BASE_FC_LT 0x100000
#define SMF_MEM_FC_ENTRY_SIZE 128
#define SMF_MEM_FC_TABLE_SIZE 4096

typedef enum {
    SMF_MISC_F_FIAR_GLB_CLA = 15, // According to SMF FS, set CLA Load/Store to 1111 and instance to MISC_F.

    SMF_L2NIC_FIAR_SQ_CMDQ_WQE = 0,
    SMF_L2NIC_FIAR_RQ_WQE = 1,

    SMF_HASH_F_FIAR_BKT_FLOW_TBL = 0,
    SMF_HASH_F_FIAR_SHADOW_FLOW_TBL = 1,

    SMF_TIMER_FIAR_TW_SPOKE_INFO = 0,

    SMF_RDMA_FIAR_QPC = 0,
    SMF_RDMA_FIAR_MPT = 1,
    SMF_RDMA_FIAR_SQ_WQE = 2,
    SMF_RDMA_FIAR_RQ_WQE = 3,
    SMF_RDMA_FIAR_CQC_SRQC = 4,
    SMF_RDMA_FIAR_RDMARC = 5,
    SMF_RDMA_FIAR_DMTT = 6,
    SMF_RDMA_FIAR_CMTT = 7,
    SMF_RDMA_FIAR_BYPASS = 14,

    SMF_RDMA_FIAR_GID = 5,

    SMF_XOE_FIAR_QPC = 0,
    SMF_XOE_FIAR_CHILD_CXT = 1,
    SMF_XOE_FIAR_SQ_WQE = 2,
    SMF_XOE_FIAR_RQ_SRQ_WQE = 3,
    SMF_XOE_FIAR_CQC_SRQC_LUN = 4,
    SMF_XOE_FIAR_L3_TMRLIST_XID2CID = 5,
    SMF_XOE_FIAR_HT_BKT = 6,
    SMF_XOE_FIAR_CLA = 7,

    SMF_IWARP_FIAR_QPC = 0,
    SMF_IWARP_FIAR_MPT = 1,
    SMF_IWARP_FIAR_SQ_WQE = 2,
    SMF_IWARP_FIAR_RQ_WQE = 3,

    SMF_IWARP_FIAR_INNERQ = 5,
    SMF_IWARP_FIAR_DMTT = 6,
    SMF_IWARP_FIAR_CMTT = 7,

    SMF_CRYPT_FIAR_CHILD_CXT = 1,
    SMF_CRYPT_FIAR_SCQC = 2,
} smf_fiar_virtual_cache_e;

// The microcode can determine the pipeline to be accessed through the NodeID(17-20) to improve the performance.
// SMF_INST_xxx_yyy_zzz: xxx: stateful service name (RoCE, FCoE, TOE, OVS,....);
//                      Yyy:engine name (RDMA, TOE, HASH_F, IFOE,...)
//                      Zzz: Optional


// resvd: 0,1

#define SMF_INST_RSS_HASH (2) // Used by RSS hash

#define SMF_INST_MISC_F (5) // Misc engine, used for root_cxt/bat access; global CLA update
#define SMF_INST_MISC_BANK_F (53) // Misc bank engine

#define SMF_INST_L2NIC (6) // l2nic engine

#define SMF_INST_TIMER (7) // timer engine

#define SMF_INST_ROCE_RDMA (8) // rdma engine, used for roce, ---Timer(srv_typ =2 QPC, 288B); (srv_typ=3 CQC, 64)
#define SMF_INST_HASH_F_GPA (3)

#define SMF_INST_TOE_SRQ_MANAGER 4 // SRQ Manager engine, used for toe service
#define SMF_INST_TOE_TOE 10        // TOE engine, used for toe service
#define SMF_INST_TOE_HASH_F 11     // HASH_F engine, used for toe service
#define SMF_INST_TOE_IFOE 12       // IFOE engine, used for toe service

// IOE
#define SMF_INST_IOE_BHEAP 15        // Bheap engine, used for ioe service
#define SMF_INST_IOE_AA_FLOW_IFOE 16 // IFOE engine, used for ioe service
#define SMF_INST_IOE_HASH_F 17       // HASH_F engine, used for IOE Child Context

// HASH_F engine, used for toe multi-host child hash, MUST be continuous
#define SMF_INST_TOE_HASH_MH0 22 // host 0
#define SMF_INST_TOE_HASH_MH1 23 // host 1
#define SMF_INST_TOE_HASH_MH2 24 // host 2
#define SMF_INST_TOE_HASH_MH3 25 // host 3

#define SMF_INST_NVME (9)             /* NVMe Egine */
#define SMF_INST_VIRTIO SMF_INST_NVME /* virtio and nvme use the same engine with same instance id */

#define SMF_INST_DSW_VOLQ (43)              // used for dsware volq cq_cqe_gen API and sq_fetch_wqe API

// FC
#define SMF_INST_FC_IFOE \
    (18) // IFOE engine, used for FCoE/FC service      ---Timer timer_off(96) //FCoE:parent_cxt=13; child_cxt=29;
         // FC:parent_cxt=12; child_cxt=28
#define SMF_INST_FC_HASH_F (21)       // HASH_F engine, used for FCoE/FC service
#define SMF_INST_FC_BHEAP (19)        // bheap engine(hierarchy), used for  service
#define SMF_INST_FC_HASH_F_CHILD (31) // child hash
#define SMF_INST_FC_IFOE_SQ (14)      // IFOE engine, used for FC SQ service :
#define SMF_INST_FC_SMF_LT (42)       // FC used for extern child ctx

#define SMF_INST_ROCE_NOFAA_S (20)  // Bheap engine(hierarchy) Aging
// BHEAP/MISC_F

#define SMF_INST_OVS_HASH_F_OVS_FLOW_TABLE 28 // HASH_F engine, used for OVS Flow Parent Context

#define SMF_INST_PPA_HASH_F_FLOW_TABLE  15  /* HASH_F engine, used for ppa Flow Parent Context */

#define SMF_INST_VROCE_HASH_F_FLOW_TABLE   (29) // HASH_F engine, used by vroce

/* ROCE instance id */
#define SMF_INST_ROCE_BHEAP (35)
#define SMF_INST_ROCE_DCQCN (36)
#define SMF_INST_ROCE_IPQCN (37)
#define SMF_INST_ROCE_CNT0 (38)
#define SMF_INST_ROCE_CNT1 (39)
#define SMF_INST_ROCE_DIF_TX_BHEAP (40)
#define SMF_INST_ROCE_DIF_RX_BHEAP (41)

#define SMF_INST_ROCE_NOFAA_WQE2HOST_LT (16) // SMF_INST_IOE_IFOE
#define SMF_INST_ROCE_NOFAA_CMIDINFO_LT (17)
#define SMF_INST_ROCE_NOFAA_SQE_BHEAP 43 // SMF_INST_DSW_VOLQ
#define SMF_INST_ROCE_NOFAA_MQP_BHEAP 22
#define SMF_INST_ROCE_ACT_HOST_BHEAP 48
#define SMF_INST_ROCE_CCF_IP_BHEAP 51
#define SMF_INST_ROCE_CCF_LOCK_BHEAP 52

#define SMF_INST_CTR_F_COUNTER_32 44
#define SMF_INST_CTR_F_COUNTER_64 45

#define SMF_INST_CAR_F   50

#define SMF_INST_CRYPT_IPSEC 13

#define SMF_INST_VROCE_HASH_FLOW_TABLE 53

#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* __cplusplus */


#endif /* SMF_INSTANCE_ID */
